package com.xiaozuo.config;

//定义一个servler容器启动的配置类，在里面加载spring的配置


import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
import org.springframework.web.servlet.support.AbstractDispatcherServletInitializer;

public  class ServletContainersInitConfig extends AbstractDispatcherServletInitializer {
    @Override
    //加载springmvc容器配置
    protected WebApplicationContext createServletApplicationContext() {
        AnnotationConfigWebApplicationContext ctx=new AnnotationConfigWebApplicationContext();
        ctx.register(SpringMvcConfig.class);
        return ctx;
    }

    @Override
    //设置那些请求归属springmvc处理
    protected String[] getServletMappings() {
        return new String[]{"/"};
    }

    @Override
    //加载spring容器配置
    protected WebApplicationContext createRootApplicationContext() {
        return null;
    }
}
